﻿#ifndef FINANCESERVICE_H
#define FINANCESERVICE_H

#include <QObject>
#include "financenetworkaccessmanager.h"
#include "financeitem.h"
#include "message.h"
#include <QPushButton>

class FinanceService : public QObject
{
    Q_OBJECT
public:
    explicit FinanceService(QObject *parent = nullptr);

    void addFinanceItem(QWidget *widget, QPushButton *button, int type, QString category, QString subject);

    void getFinanceItems(QWidget *widget);

    void addFinanceRecord(QWidget *widget, QPushButton *button, FinanceItem *financeItem, double money, QString remark);

    void deleteFinanceItem(QWidget *widget, FinanceItem *financeItem);

    void updateFinanceItem(QWidget *widget, FinanceItem *financeItem);

    void financeQuery(QWidget *widget, int type1, int type2, QString startDate, QString endDate);
signals:
    void addFinanceItemSuccess();

    void getFinanceItemsSuccess(QList<FinanceItem*> financeItems);

    void addFinanceRecordSuccess();

    void financeQuerySuccess(QList<Message*> messages);
public slots:

private:
    FinanceNetworkAccessManager *manager;
};

#endif // FINANCESERVICE_H
